package com.mu.design;



import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @Classname CashCard
 * @Description 模拟储蓄卡功能
 * @Date 2023/2/15 14:27
 * @Created by JiangMuyun
 */
public class CashCard {

    private Logger logger = LoggerFactory.getLogger(CashCard.class);

    /**
     * Description TODO
     * @date 2023/2/15 14:32
     * @user JiangMuyun
     * @param orderId 单号
     * @param amount 金额
     * @return java.lang.String 状态码 0000成功 0001失败 0002重复
     **/
    public String withdrawal(String orderId, BigDecimal amount) {
        //模拟支付成功
        logger.info("提现成功，单号：{} 金额：{}", orderId, amount);
        return "0000";
    }

    /**
     * Description 储蓄
     * @date 2023/2/15 14:35
     * @user JiangMuyun
     * @param orderId 单号
     * @param amount 金额
     * @return java.lang.String
     **/
    public String recharge(String orderId, BigDecimal amount) {
        // 模拟充值成功
        logger.info("储蓄成功，单号：{} 金额：{}", orderId, amount);
        return "0000";
    }

    /**
     * Description 交易流水查询
     * @date 2023/2/15 14:36
     * @user JiangMuyun
     * @return java.util.List<java.lang.String> 交易流水
     **/
    public List<String> tradeFlow() {
        logger.info("交易流水查询成功");
        List<String> tradeList = new ArrayList<String>();
        tradeList.add("100001,100.00");
        tradeList.add("100001,80.00");
        tradeList.add("100001,76.50");
        tradeList.add("100001,126.00");
        return tradeList;
    }
}
